Skip to content

Conversation

@topecongiro
Copy link
Contributor

trailing_semicolon controls whether to add a trailing semicolon after break, continue and return.

Closes #993.

@nrc
Copy link
Member

nrc commented Jul 12, 2017

Needs a rebase.

I've got mixed feelings about this. My personal opinion is that this is simply the wrong thing to do and we shouldn't encourage it. OTOH, it is something that people request sometimes, so it seems reasonable to add. I'd be happy to merge it now, but the style team should at some point review the options, and this is the kind of thing we might remove at that stage.

trailing_semicolon controls whether to add a trailing semicolon after break,
continue and return.
@topecongiro
Copy link
Contributor Author

Rebased.

As a person from C, I do not prefer removing semicolons from break, continue and return, but not strongly against it. However, some people who are more familiar with languages without semicolon (e.g. Ruby) seems to prefer using break instead of break;.
It is completely acceptable to me if the style team prefers to remove this option at some point.

Also, I am kind of curious whether we could allow single line if expression with a single continue and alike.
e.g.

if x { continue; }

@nrc
Copy link
Member

nrc commented Jul 12, 2017

Also, I am kind of curious whether we could allow single line if expression with a single continue and alike.

We (style team) decided mostly against this sort of thing. Basically, in statement form (which this must be), multi-line control flow is much clearer than single line. We think it basically only makes sense to use the single line form where the if is nested inside an expression.

Thanks for the rebase (and the PR)!

@nrc nrc merged commit 43af9c8 into rust-lang:master Jul 12, 2017
@topecongiro topecongiro deleted the trailing-semicolon branch July 12, 2017 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants